<template>
  <el-container class="home-container">
    <!-- 页面主题区 -->
    <el-container>
      <!-- 侧边栏 -->
      <el-scrollbar style="height: 100%" class="page-scroll">
        <el-aside width="200px">
          <el-col :span="12">
            <el-menu
              default-active="2"
              class="el-menu-vertical-demo"
              @open="handleOpen"
              @close="handleClose"
              background-color="#479082"
            >
              <el-submenu index="1">
                <template slot="title">
                  <i class="el-icon-menu"></i>
                  <span>内科</span>
                </template>
                <el-menu-item-group>
                  <el-menu-item index="1-1"><router-link to="/test/test1" style=" text-decoration: none;">消化内科</router-link></el-menu-item>
                </el-menu-item-group>
              </el-submenu>
              <el-submenu index="2">
                <template slot="title">
                  <i class="el-icon-location"></i>
                  <span>外科</span>
                </template>
                <el-menu-item-group>
                  <el-menu-item index="1-1"><router-link to="/test/test2" style=" text-decoration: none;">神经外科</router-link></el-menu-item>
                </el-menu-item-group>
              </el-submenu>
              <el-submenu index="3">
                <template slot="title">
                  <i class="el-icon-location"></i>
                  <span>口腔科</span>
                </template>
                <el-menu-item-group>
                  <el-menu-item index="1-1"><router-link to="/test/test1" style=" text-decoration: none;">口腔科</router-link></el-menu-item>
                </el-menu-item-group>
              </el-submenu>
            </el-menu>
          </el-col>
        </el-aside>
      </el-scrollbar>
      <!-- 主内容 -->
      <el-main class="el-main">
        <el-card class="datecard">
            <div style="float:left">{{this.datetime|dateFormat2}}</div>
            <div class="block">
              <span class="demonstration">预约日期</span>
              <el-date-picker
                v-model="value"
                align="right"
                type="date"
                @change="selectTime(value)"
                placeholder="选择日期"
                :picker-options="pickerOptions">
              </el-date-picker>
            </div>
        </el-card>
        <el-card class="appointment">
            <router-view></router-view>
        </el-card>
      </el-main>
    </el-container>
  </el-container>
</template>

<script>
export default {
  components: {},
  data() {
    return {
      datetime:"",
      value:"",//选择的日期
      pickerOptions: {
          disabledDate(time) {
            return time.getTime() < Date.now()- 8.64e7;
          },
          shortcuts: [{
            text: '今天',
            onClick(picker) {
              picker.$emit('pick', new Date());
              console.log(this.value);
              console.log(Date.now);
            }
          }]
        },
    };
  },
  mounted(){
    this.datetime=new Date();
  },
  methods: {
    selectTime(value){
      //用户选择门诊日期
      this.$store.state.departmenttime3=value;
      this.$store.state.departmenttime=value.getDay();
      let yy=value.getFullYear();
      let mm=value.getMonth()+1;
      let dd=value.getDate();
      var ymd=yy+"-"+mm+"-"+dd;
      this.$store.state.departmenttime2=ymd;
      // console.log("this.$store.state.departmenttime"+this.$store.state.departmenttime);
      // console.log(this.$store.state.departmenttime.getDay());
      // alert(this.$store.state.departmenttime.getDay())
    },
    handleOpen(key, keyPath) {
        console.log(key, keyPath);
      },
      handleClose(key, keyPath) {
        console.log(key, keyPath);
      },
     
  },
};
</script>

<style  scoped>
.home-container {
  width: 100%;
  height: 600px;
}
.el-header {
  background-color: #479082;
  display: flex;
  /* 左右贴边对齐 */
  justify-content: space-between;
  font-family: "Helvetica";
  color: #eefaf2;
  font-size: 20px;
}
.el-aside {
  background-color: #479082;
}
.el-aside::-webkit-scrollbar{
    display: none;
}
.page-scroll{
    height: 100%;
    overflow-x: hidden;
    background: #479082 !important;
}
.page-scroll >>> .el-menu-item:hover{
    background: #749f83 !important;
    color: black !important;
}
.el-scrollbar__wrap {
   overflow-x: hidden;
}
.el-menu {
  width: 200px;
  min-height: 100%;
}
.el-main {
  background-color: #eefaf2;
}
.datecard{
    width: 1000px;
    margin-left: 100px;
}
.appointment{
     width: 1000px;
     height: 80%;
     margin-left: 100px;
     margin-top: 30px;
}
.block{
  float: right;
}
</style>
